﻿using DevExpress.XtraGrid.Demos.util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.订单一览新.销售确认单
{
    public partial class Form客户套号查询 : DevExpress.XtraEditors.XtraForm
    {
        private Form条码查询 form条码查询 = new Form条码查询();
        public Form客户套号查询()
        {
            InitializeComponent();
        }

        private void dateTimePicker开始时间_CloseUp(object sender, EventArgs e)
        {
            this.一览刷新();
        }

        private void dateTimePicker结束时间_CloseUp(object sender, EventArgs e)
        {
            this.一览刷新();
        }
        private void 一览刷新()
        {
            this.gridControl套号订单.DataSource = 销售确认Service.getSaleConfirmListOrderDateBetween(
                this.dateTimePicker开始时间.Value.ToString("yyyy-MM-dd"),
                this.dateTimePicker结束时间.Value.ToString("yyyy-MM-dd"));
        }

        private void bandedGridView套号订单_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            String saleOrderDetailId = FunctionHelper.GetbandedgridViewValue(this.bandedGridView套号订单, this.bandedGridView套号订单.FocusedRowHandle, "saleOrderDetailId");
            String saleConfirmId = FunctionHelper.GetbandedgridViewValue(this.bandedGridView套号订单, this.bandedGridView套号订单.FocusedRowHandle, "id");
            this.form条码查询 = new Form条码查询(saleOrderDetailId, saleConfirmId);
            this.form条码查询.Dock = DockStyle.Fill;
            this.form条码查询.TopLevel = false;
            this.form条码查询.Parent = this.panel其他销售订单;
            this.form条码查询.Show();
            this.panel其他销售订单.Controls.Clear();
            this.panel其他销售订单.Controls.Add(this.form条码查询);
        }

        private void bandedGridView套号订单_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.Column.Name.Equals("gridColumn尺码"))
            {
                if (!String.IsNullOrWhiteSpace(e.DisplayText))
                {
                    try { e.DisplayText = e.DisplayText.Replace("IGS_GROUP_SIZE-", "").Replace("EGS_GROUP_SIZE-", ""); } catch { }
                }
            }
        }
    }
}
